<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
    #menu {
        display:none;
        position: absolute;
        top:20px;
        left: 50px;
        padding: 20px;
        background: #f2f2f2;
        border: 1px solid #ccc;
    }
    </style>
</head>
<body>
    <div id="toggleBtn">Toggle Menu</div>
    <div id="menu">
        <p>Menu Context</p>
        <button id="closeInside">Don't closed</button>
    </div>
    <script>
        const toggleBtn = document.getElementById('toggleBtn');
        const menu = document.getElementById('menu');
        const closeInside = document.getElementById('closeInside');

        toggleBtn.addEventListener('click',function(e) {
            e.stopPropagation();
            menu.style.display = menu.style.display === 'block' ? 'none' : 'block';
        })

        document.addEventListener('click',function() {
            menu.style.display = 'none';
        })

        closeInside.addEventListener('click',function(e) {
            e.stopPropagation();
            alert("Menu button clicked");
        }) 
    </script>
</body>
</html>